click a button to open query